home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-12-08 | 1.3 KB | 31 lines | [TEXT/GEOL] |
- Item 1139562 8-Dec-89 11:30
-
- From: PASCOE1 Pascoe, Geoff
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Re: Failure Handling
-
- Jo-Anne,
-
- The technique you outline is perfectly fine and will do the job nicely. For an
- alternative techniques see TView.Adorn. Here, the failure handler employs a
- GOTO to go to the last bit of code in the routine that frees the objects (or
- handles)- since they're temps, the routine will normally have to free them
- before it exits anyway. Of course, here you must rely on FreeIfObject to
- detect the an already freed object so it won't free it again.
-
- Personally, I prefer the nested failure handlers. It's slightly more verbose
- but is more structured and, for me, easier to understand. Also, I feel
- slightly uncomfortable relying on FreeIfObject for detecting anything but the
- case where the reference is NIL - I like to be a little bit more in control.
- Also for this reason, unlike Curtis, I choose to do the initial NIL assignments
- before I start.
-
- Geoff
-
- P.S. For clarity, I tend to indent the statements between CatchFailures and
- Success, as if CachFailures == BEGIN and Success == END. For me, it helps make
- the situation clearer, especially when the failure handlers are nested.
-
-